#include<bits/stdc++.h>
#define INF 2147483647
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef const long long cll;
const int N = 500010;
ll n;
struct Edge {
    ll to, next;
    Edge() {}
} edge[N];
ll head[N], cnt = 0;
void add(cll &u, cll &v) {
    edge[++cnt].to = v;
    edge[cnt].next = head[u];
    head[u] = cnt;
}
ll size[N], weight[N], centroid[2] = {0, INF};
void GetCentroid(cll &father, cll &step) {
    size[step] = 1;
    weight[step] = 0;
    for(ll i = head[step]; i; i = edge[i].next) {
        if(edge[i].to != father) {
            GetCentroid(step, edge[i].to);
            size[step] += size[edge[i].to];
            weight[step] = max(weight[step], size[edge[i].to]);
        }
    }
    weight[step] = max(weight[step], n - size[step]);
    if(weight[step] <= (n >> 1)) {
        centroid[centroid[0] != 0] = step;
    }
}
ll sum = 0;
void GetDistance(cll &father, cll &step, cll &num) {
    sum += num;
    for(ll i = head[step]; i; i = edge[i].next) {
        if(edge[i].to != father) {
            GetDistance(step, edge[i].to, num + 1);
        }
    }
}
int main() {
    ll a, b;
    scanf("%lld", &n);
    for(ll i = 1; i < n; i++) {
        scanf("%lld%lld", &a, &b);
        add(a, b);
        add(b, a);
    }
    GetCentroid(0, 1);
    ll TreeCentroid = min(centroid[0], centroid[1]);
    GetDistance(0, TreeCentroid, 0);
    printf("%lld %lld\n", TreeCentroid, sum);
    return 0;
}